/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pingce.share.model.raw;

import java.io.Serializable;

/**
 *
 * @author ucai
 */
public class Target implements Serializable{
    /**
	 * 
	 */
	private static final long serialVersionUID = 6090267780656638983L;
	public int id = -1;
    public int begin = -1;
    public int end = -1;
    public String text = null;
    public String polarity = null;
    public String info = "";

    public Target(int id, int start, int end, String text, String polarity){
        this.id = id;
        this.begin = start;
        this.end = end;
        this.text = text;
        this.polarity = polarity;
    }
    public Target(int start, int end, String text, String info){
    	this(0, start, end, text, "");
    	this.info = info;
    }
    public Target(int id){this.id = id;}
    public Target(){}

    @Override
	public boolean equals(Object obj) {
		// TODO Auto-generated method stub
    	return this.hashCode() == obj.hashCode() ? true : false;
//		return super.equals(obj);
	}
	@Override
    public String toString(){
        return new Integer(id).toString();
    }
	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		int code = (begin + end) * (end - begin);
		return code;
//		return super.hashCode();
	}
    
}
